/*******************************************************************************
 * Copyright (c) 2012, G. Weirich and Elexis
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    G. Weirich - initial implementation
 *******************************************************************************/

package ch.elexis.easy.core;

import org.eclipse.rwt.SessionSingletonBase;

import ch.elexis.core.IConfiguration;
import ch.elexis.core.data.IMandator;
import ch.elexis.core.data.IUser;
import ch.rgw.io.Settings;

/**
 * Magic object from RAP: different user sessions will all get their own different Configuration object, but one
 * user session will always receive the same object through different calls. 
 * @author gerry
 *
 */
public class Configuration extends SessionSingletonBase implements
		IConfiguration {

	private Configuration() {
	}

	public static Configuration getInstance() {
		return (Configuration) getInstance(Configuration.class);
	}

	private IUser user;
	private IMandator mandator;
	private Settings localCfg;
	private Settings globalCfg;
	private Settings userCfg;
	private Settings mandatorCfg;

	@Override
	public IUser getUser() {
		return user;
	}

	@Override
	public void setUser(IUser user) {
		this.user = user;
	}

	@Override
	public IMandator getMandator() {
		return mandator;
	}

	@Override
	public void setMandator(IMandator m) {
		mandator = m;
	}

	@Override
	public Settings getGlobalConfiguration() {
		return globalCfg;
	}

	@Override
	public void setGlobalConfiguration(Settings c) {
		globalCfg = c;
	}

	@Override
	public Settings getUserConfiguration() {
		return userCfg;
	}

	@Override
	public void setUserConfiguration(Settings c) {
		userCfg = c;
	}

	@Override
	public Settings getMandatorConfiguration() {
		return mandatorCfg;
	}

	@Override
	public void setMandatorConfiguration(Settings c) {
		mandatorCfg = c;
	}

	@Override
	public Settings getLocalConfiguration() {
		return localCfg;
	}

}
